package zcl.servlet;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/cart")
public class cartServlet extends HttpServlet {
    @Override
    public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
        //根据不同cmd的值,调用不同的方法
        String cmd = req.getParameter("cmd");
        if (StringUtils.isNoneBlank(cmd)){
            if ("add".equals(cmd)){
                add(req,res);
            }
        }
    }

    private void add(HttpServletRequest req, HttpServletResponse res) {
         String pid = req.getParameter("pid");
         ServletContext servletContext = req.getServletContext();

    }
}
